/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package servidorbancos;

import com.sun.grizzly.http.SelectorThread;
import com.sun.jersey.api.container.grizzly.GrizzlyWebContainerFactory;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author cpaz
 */
public class ServidorBancosREST {

    /*
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        final String baseUri = "http://localhost:9998/";
        final Map<String, String> initParams = new HashMap<String, String> ();
        initParams.put("com.sun.jersey.config.property.packages", "servidorbancos.resources");
        SelectorThread threadSelector = GrizzlyWebContainerFactory.create(baseUri, initParams);
        System.in.read();
        threadSelector.stopEndpoint();
        System.exit(0);
        /*
        double[] origem = {-23.686572, -46.700746};
        AgenciaResource ar = new AgenciaResource();
        ListaAgencias teste = new ListaAgencias();
        AgenciaUtil teste2 = new AgenciaUtil(teste.getListaAgencias(), -23.686528, -46.700737);
        ArrayList<Agencia> aux = (ArrayList<Agencia>) teste2.GetAgenciasProximas(5, 0, 0, 0, 0, 0, 0, 0, 0, 0);
        ar.getMenorCaminho(origem, aux);
        
        double[] origem = {-23.686572, -46.700746};
        ListaAgencias teste = new ListaAgencias();
        RedeNeural rn = new RedeNeural(teste.getListaAgencias());
        rn.Treinar();
        System.out.println(rn.calcula(-23.686572, -46.700746));
        AgenciaUtil teste2 = new AgenciaUtil(teste.getListaAgencias(), -23.686528, -46.700737);
        ArrayList<Agencia> aux = (ArrayList<Agencia>) teste2.GetAgenciasProximas(1, 2, 3, 4, 5, 5, 4, 3, 2, 1);
        try {

            int tamanhoPopulacao = 8;
            int iteracoes = 50000;
            float taxaMutacao = 0.1f;
            CaixeiroViajante cxv = new CaixeiroViajante();
            cxv.getMenorCaminho(origem, aux, tamanhoPopulacao, taxaMutacao, iteracoes);
            
        } catch (Exception ex) {
            Logger.getLogger(ServidorBancosREST.class.getName()).log(Level.SEVERE, null, ex);
        }
        /**/        
    }
}
